package com.quanta.wise.lite.server.demo.flow.component;

/**
 * @author hanhuafeng
 * @version V1.0
 * @description
 * @date 2023/5/31
 */

import com.quanta.wise.annotation.RuleComponent;
import com.quanta.wise.enums.ElNameEnum;
import com.quanta.wise.lite.server.demo.flow.bo.GetMethodBo;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;

import java.util.Map;

@LiteflowComponent("GetComponent")
@RuleComponent(params = GetMethodBo.class, flowCmpId = "GetComponent", cmpType = ElNameEnum.COMMON, defaultText = "GET")
public class GetComponent extends NodeComponent {
    @Override
    public void process() throws Exception {

        GetMethodBo getMethod = this.getCmpData(GetMethodBo.class);
        if (getMethod != null) {
            // 获取流程的初始参数
            Map<String, Object> params = this.getRequestData();
            String url = getMethod.getUrl();
            for (Map.Entry<String, Object> entry : params.entrySet()) {
                System.out.println("key is " + entry.getKey() + " value is " + entry.getValue());
                Object param = entry.getValue();
            }
            System.out.println("getMethod url is " + url);
        }
        System.out.println(getMethod);
        System.out.println("GetMethod executed!");
    }
}
